package main

import (
	"blog/conf"
	"blog/dao"
	"blog/router"
	"flag"
	"github.com/zxysilent/logs"
	"os"
	"os/signal"
	"syscall"
)

// @Title Blog’s 接口文档
// @Version 1.0
// @Description token传递方式包括[get/post]token、[header]Authorization
// @Description /api/* 公共访问
// @Description /adm/* 必须传入 token
// @Host 127.0.0.1:8085
// @BasePath /
var configFile = flag.String("config", "conf/application.yaml", "配置文件路径")

func main() {
	logs.Info("app initializing")
	conf.InitConf(*configFile)
	dao.Init()
	conf.AppConf.InitNacos()
	quit := make(chan os.Signal)
	signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)
	logs.Info("app running")
	go router.RunApp()
	<-quit
	dao.Close()
	logs.Info("app quitted")
	logs.Flush()
}
